Hệ thống quản lý phòng khám trực tuyến bằng PHP

1 <?php if(!isset($Translation)) die('No direct access allowed.'); ?>
2 <?php $current_table =
'disease_symptoms'; ?>
3 <?php
4     $cleaner =
new CI_Input();
5     $cleaner->charset = datalist_db_encoding;
6 ?>
7 <script>
8     <?php echo $current_table; ?>GetChildrenRecordsList = function(command){
9         
var param = {
10             ChildTable:
"<?php echo $parameters['ChildTable']; ?>",
11             ChildLookupField:
"<?php echo $parameters['ChildLookupField']; ?>",
12             SelectedID:
"<?php echo addslashes($parameters['SelectedID']); ?>",
13             Page: <?php echo addslashes($parameters[
'Page']); ?>,
14             SortBy: <?php echo ($parameters[
'SortBy'] === false ? '""' : $parameters['SortBy']); ?>,
15             SortDirection:
'<?php echo $parameters['SortDirection']; ?>',
16             AutoClose: <?php echo ($config[
'auto-close'] ? 'true' : 'false'); ?>
17         };
18         
var panelID = "panel_<?php echo "{$parameters['ChildTable']}-{$parameters['ChildLookupField']}"; ?>";
19         
var mbWidth = window.innerWidth * 0.9;
20         
var mbHeight = window.innerHeight * 0.8;
21         
if(mbWidth > 1000){ mbWidth = 1000; }
22         
if(mbHeight > 800){ mbHeight = 800; }
23
24         
switch(command.Verb){
25             
case 'sort': /* order by given field index in 'SortBy' */
26                 post(
"parent-children.php", {
27                     ChildTable: param.ChildTable,
28                     ChildLookupField: param.ChildLookupField,
29                     SelectedID: param.SelectedID,
30                     Page: param.Page,
31                     SortBy: command.SortBy,
32                     SortDirection: command.SortDirection,
33                     Operation:
'get-records-printable'
34                 }, panelID, undefined,
'pc-loading');
35                 
break;
36             
case 'page': /* next or previous page as provided by 'Page' */
37                 
if(command.Page.toLowerCase() == 'next'){ command.Page = param.Page + 1; }
38                 
else if(command.Page.toLowerCase() == 'previous'){ command.Page = param.Page - 1; }
39
40                 
if(command.Page < 1 || command.Page > <?php echo ceil($totalMatches / $config['records-per-page']); ?>){ return; }
41                 post(
"parent-children.php", {
42                     ChildTable: param.ChildTable,
43                     ChildLookupField: param.ChildLookupField,
44                     SelectedID: param.SelectedID,
45                     Page: command.Page,
46                     SortBy: param.SortBy,
47                     SortDirection: param.SortDirection,
48                     Operation:
'get-records-printable'
49                 }, panelID, undefined,
'pc-loading');
50                 
break;
51             
case 'reload': /* just a way of refreshing children, retaining sorting and pagination & without reloading the whole page */
52                 post(
"parent-children.php", {
53                     ChildTable: param.ChildTable,
54                     ChildLookupField: param.ChildLookupField,
55                     SelectedID: param.SelectedID,
56                     Page: param.Page,
57                     SortBy: param.SortBy,
58                     SortDirection: param.SortDirection,
59                     Operation:
'get-records-printable'
60                 }, panelID, undefined,
'pc-loading');
61                 
break;
62         }
63     };
64 </script>
65
66 <div
class="row">
67     <div
class="col-xs-12 col-md-12">
68
69         <div
class="page-header"><h1>
70             <?php echo ($config[
'table-icon'] ? '<img src="' . $config['table-icon'] . '">' : ''); ?>
71             <?php echo $config[
'tab-label']; ?>
72         </h1></div>
73
74
75         <div
class="table-responsive">
76             <table
class="table table-striped table-hover table-condensed table-bordered">
77                 <thead>
78                     <tr>
79                         <?php
if(is_array($config['display-fields'])) foreach($config['display-fields'] as $fieldIndex => $fieldLabel){ ?>
80                             <th
81                                 <?php
if($config['sortable-fields'][$fieldIndex]){ ?>
82                                     onclick=
"<?php echo $current_table; ?>GetChildrenRecordsList({
83                                         Verb: 'sort',
84                                         SortBy: <?php echo $fieldIndex; ?>,
85                                         SortDirection: '<?php echo ($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc' ? 'desc' : 'asc'); ?>'
86                                     });"

87                                     style=
"cursor: pointer;"
88                                 <?php } ?>
89                                 
class="<?php echo "{$current_table}-{$config['display-field-names'][$fieldIndex]}"; ?>">
90                                 <?php echo $fieldLabel; ?>
91                                 <?php
if($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'desc'){ ?>
92                                     <i
class="glyphicon glyphicon-sort-by-attributes-alt text-warning"></i>
93                                 <?php }elseif($parameters[
'SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc'){ ?>
94                                     <i
class="glyphicon glyphicon-sort-by-attributes text-warning"></i>
95                                 <?php } ?>
96                             </th>
97                         <?php } ?>
98                     </tr>
99                 </thead>
100                 <tbody>
101                     <?php
if(is_array($records)) foreach($records as $pkValue => $record){ ?>
102                     <tr>
103                         <td
class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[1]); ?></td>
104                         <td
class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean(nl2br($record[2])); ?></td>
105                         <td
class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}"; ?> text-right" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php if($record[3]){ ?><a href="link.php?t=<?php echo $parameters['ChildTable']; ?>&f=reference&i=<?php echo urlencode($record[$config['child-primary-key-index']]); ?>" target="_blank"><?php echo $cleaner->xss_clean($record[3]); ?></a><?php } ?></td>
106                     </tr>
107                     <?php } ?>
108                 </tbody>
109                 <tfoot>
110                     <tr>
111                         <td colspan=
"<?php echo count($config['display-fields']); ?>">
112                             <?php
if($totalMatches){ ?>
113                                 <?php
if($config['show-page-progress']){ ?>
114                                     <span style=
"margin: 10px;">
115                                         <?php $firstRecord = ($parameters[
'Page'] - 1) * $config['records-per-page'] + 1; ?>
116                                         <?php echo str_replace(array(
'<FirstRecord>', '<LastRecord>', '<RecordCount>'), array($firstRecord, $firstRecord + count($records) - 1, $totalMatches), $Translation['records x to y of z']); ?>
117                                     </span>
118                                 <?php } ?>
119                             <?php }
else{ ?>
120                                 <span
class="text-danger" style="margin: 10px;"><?php echo $Translation['No matches found!']; ?></span>
121                             <?php } ?>
122                         </td>
123                     </tr>
124                 </tfoot>
125             </table>
126         </div>
127         <?php
if($totalMatches){ ?>
128             <div
class="row hidden-print">
129                 <div
class="col-xs-12">
130                     <button type=
"button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'previous' });"><i class="glyphicon glyphicon-chevron-left"></i></button>
131                     <button type=
"button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'next' });"><i class="glyphicon glyphicon-chevron-right"></i></button>
132                 </div>
133             </div>
134         <?php } ?>
135     </div>
136 </div>
137 <script>$j(function(){ $j(
'img[src^="thumbnail.php?i=&"').parent().hide(); });</script>


Gõ tìm kiếm nhanh...